
#ifndef SERVICE_QUEUE_H_
#define SERVICE_QUEUE_H_

namespace fasmio { namespace service {

class ITask;
class IService;

typedef bool (*TaskFilter)(IService* service, const char* dest_host, const ITask* task);


class IInQueue
{
public:
    virtual ~IInQueue() {};

public:
    virtual ITask*         GetTask    () = 0;
    virtual ITask*         GetTask    (bool blocking,
                                       unsigned timeout) = 0;

    virtual unsigned long  GetTasks   (ITask* tasks[],
                                       unsigned long count) = 0;
    virtual unsigned long  GetTasks   (ITask* tasks[],
                                       unsigned long count,
                                       bool blocking,
                                       unsigned timeout) = 0;

    virtual void           TaskDone   () = 0;
    virtual void           TaskDone   (unsigned long count) = 0;

    virtual unsigned long  GetSize    () = 0;

    virtual unsigned long  GetTraffic () = 0;
};


class IOutQueue
{
public:
    virtual ~IOutQueue() {};

public:
    virtual bool           AddTask    (ITask* task) = 0;

    virtual bool           SetFilter  (TaskFilter filter) = 0;

    virtual unsigned long  GetSize    () = 0;

    virtual unsigned long  GetTraffic () = 0;
};


}}  // namespace fasmio::service

#endif  // SERVICE_QUEUE_H_

